package org.erp.store.infrastructure.enums;

/**
 * 库存状态枚举
 * 入库、调拨中、接驳、驳回、待返库、待退库、已退库、售出
 */
public enum DeviceInventoryState {
    /** 入库 */
    INBOUND(1,"入库"),
    /** 调拨中 */
    TRANSFERRING(2,"调拨中"),
    /** 接驳 */
    HANDOVER(3,"接驳"),
    /** 驳回 */
    REJECTED(4,"驳回"),
    /** 待返库 */
    WAIT_RETURN(5,"待返库"),
    /** 待退库 */
    WAIT_REFUND(6,"待退库"),
    /** 已退库 */
    REFUNDED(7,"已退库"),
    /** 售出 */
    SOLD(8,"售出");

    private final Integer code;
    private final String message;
    DeviceInventoryState(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    public static String getMessageByCode(Integer code) {
        for (DeviceInventoryState value : DeviceInventoryState.values()) {
            if (value.code.equals(code)) {
                return value.message;
            }
        }
        return null;
    }
    public static Integer getCodeByMessage(String message) {
        for (DeviceInventoryState value : DeviceInventoryState.values()) {
            if (value.message.equals(message)) {
                return value.code;
            }
        }
        return null;
    }
    public Integer getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }


    public static DeviceInventoryState getByCode(Integer code) {
        for (DeviceInventoryState value : DeviceInventoryState.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static DeviceInventoryState getByMessage(String message) {
        for (DeviceInventoryState value : DeviceInventoryState.values()) {
            if (value.message.equals(message)) {
                return value;
            }
        }
        return null;
    }

   
}